Iubenda logo
Start generating

Documentation

Table of Contents

Google Analytics 4 (GA4) – all you need to know

In this guide, we’ll answer the main questions about Google Analytics 4, the main new features, how to switch to GA4, what data are being collected, the concerns about compliance with privacy regulations like the GDPR, and so on.

Let’s dig into it.

What’s Google Analytics 4?

Google Analytics (GA) 4 is the new property replacing the old GA3 version. Google officially released it in October 2020, and it has replaced GA3 entirely on July 1, 2023.

As stated by Google, this new version provides these main characteristics:

  • Collects both website and app data to understand the customer journey better
  • Uses events instead of session-based data
  • Includes privacy controls such as cookieless measurement and behavioral and conversion modeling
  • Predictive capabilities offer guidance without complex models
  • Direct integrations to media platforms help drive actions

Universal analytics vs. Google Analytics 4 – what are the main differences?

Universal Analytics used to be the standard Google Analytics Snippet and used a measurement model based on sessions and pageviews.
A session is a group of user interactions (hits) with a website that takes place over a given timeframe. A session can contain multiple page views, events, and eCommerce transactions.
The most significant difference with the new version is that Google Analytics 4 uses a measurement model based on events and parameters.

An event allows measuring user interaction on a website or app. Any “hit” can be captured as an event.
Events are divided by:

Automatically collected events
The following parameters are collected by default with every event, including custom events:
– language
– page_location
– page_referrer
– page_title
– screen_resolution

Enhanced Measurement events – These events allow measuring interactions with the website’s content by enabling options (events) in the Google Analytics interface. These events include scrolls, outbound clicks, site search, and video engagement.

Recommended Events – These are events recommended by Google to help measure additional features and behavior and generate more detailed reports.

Custom Events – Events and parameters that can be created and implemented based on website requirements.

Is Google Analytics 4 GDPR-compliant?

On July 10, 2023, the European Commission announced the new EU-US Data Privacy Framework (DPF). With this decision, the United States is once again recognized as providing an adequate level of protection to its European Union counterpart. Consequently, personal data can now flow freely from the EU to US self-certified companies without the need for additional safeguards. Users can check the certification status of companies at this link. Currently, Google is reported to be in line with the new requirements.

In this regard, the most important change is that Google Analytics 4 uses IP addresses only to determine location information (country, city, latitude, and longitude of the city) and then discards it before data is logged into any server. Moreover, it’s possible to minimize the collection of personal data by turning off the collection of Google Signals data based on geographic area and disabling the collection of granular location data. This aligns with the ‘data minimization’ principle of the GDPR and is considered a best practice for compliance. Website owners can also delete users’ data, following a specific request.

The new framework, however, does not make Google Analytics 4 automatically GDPR compliant, but only ensures the free transfer of data. It remains a responsibility of the website owner to ensure that the collection and processing of data through GA4 is in line with the GDPR.

So remember to:

  • enable the prior blocking of cookies and acquire explicit consent from your users to use GA4;
  • include Google Analytics 4 in your privacy policy. You can find the clause for Google Analytics 4 within the Privacy and Cookie Policy Generator in your iubenda dashboard.

Do I need to anonymize the IP for Google Analytics 4? And is it prior-blocking required?

Google Analytics 4 uses IP addresses at collection time to determine location information (country, city, latitude, and longitude of the city) and then discards it before data is logged into any server.

This is something new and a big difference from Universal Analytics which needed a particular tag to anonymize IP.
IP anonymization is always enabled for GA4 properties and no manual action is required.

Regarding the prior blocking, since Google Analytics can install analytics cookies for profiling purposes, it is necessary to block them before obtaining the user’s explicit consent. However, by enabling the new Google Consent Mode v2 you can still collect data in aggregate form and continue to optimize the performance of your site.

How do I switch to Google Analytics 4?

To switch to GA4, Google provides a GA4 Setup Assistant on the Admin page of a Google Analytics installation. 
You can follow these instructions from Google documentation.

If your site uses the gtag.js tag, you have the option to Enable data collection using your existing tags. GA4 has the same script, and no code changes are required.
Example of a gtag.js version:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script type="text/javascript" async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'UA-XXXXXXXXXXX-1');
</script>
<!-- End Google Analytics -->

If Analytics has been set up before August 2017, the site is probably tagged with analytics.js. In this case, the wizard can’t reuse your existing tagging, and you’ll need to add the tag yourself following these instructions.

TRACKING ID vs. MEASUREMENT ID:

The tracking ID is a string like UA-000000-2. It is included in your tracking code to tell Analytics which account and property to send data to. It’s the identifier used by Google Analytics 3.

When you set up a Google Analytics 4 property, you have a Measurement ID instead of a Tracking ID. A Measurement ID uses the format G-XXXXXXX and identifies the data stream sending data to your Google Analytics 4 property.

Which identifiers does Google Analytics use?

Each activity a user can perform on a website could use different devices and platforms in separate sessions. 
Google Analytics 4 can use different methods to unify these interactions into a single cross-device user journey:

  • User ID – used to measure user journeys across devices. User-ID is the most accurate identifier because it uses data you collect to identify your users
  • Google signals – data from users who are signed in to Google
  • Device ID – On websites, the device ID gets its value from the client ID. On apps, the device ID is the app-instance ID
  • Modeling – it’s used when users decline Analytics identifiers like cookies. Analytics uses the data of similar users who do accept cookies from the same property to fill this gap

What data does Google Analytics collect?

Through the default implementation, these data are collected by GA4: number of users, session statistics, approximate geolocation, and browser and device information. Along with the parameters that are collected by default with every event (see above).

Furthermore, Analytics collects a set of “granular location and device data” that are:

  • Latitude (of city)
  • Longitude (of city)
  • Browser minor version
  • Browser User-Agent string
  • Device brand
  • Device model
  • Device name
  • Operating system minor version
  • Platform minor version
  • Screen resolution

The collection of granular location-and-device data can be disabled. Click here to see how.

How long can user-level data be retained with Google Analytics 4?

While for Universal Analytics user-level and event-level data properties could have an indefinite duration, user-level data can be retained for a maximum of 14 months for Google Analytics 4 properties.

Will I lose data when updating to Google Analytics 4?

As we mentioned earlier, GA4 uses a new type of event-based measurement, in contrast to the previous measurement of page views/session. Universal Analytics properties stopped collecting data on July 1st, 2023, and historic data will be deleted six months later. 
Since Google Analytics 4 uses a different tracking code, it is impossible to simply “migrate” or “upgrade” a property from Universal Analytics to GA4 and data will not be directly comparable to UA data.
This is why users were recommended to switch as early as possible: To guarantee a set of performance data for the maximum retention period for user-level data in GA4, considering that it would be the only usable version since July 2023.

What data collection settings can not be migrated on Google Analytics 4?

These data collection settings have no equivalent in GA 4:

  • control over IP anonymization – IP anonymization is now enabled by default
  • timing

Furthermore, if you’re using analytics.js, custom task is not available in Google Analytics 4.

How do I delete users’ data from Google Analytics?

You may be asked by a given user to delete all data about them, including data collected with Google Analytics.
Google Analytics provides two methods to delete users’ data: User exploration or User Deletion API.

To delete a given user data via the first method, you have to create a User exploration, find the relevant data you want to delete and then delete them. You can follow this guide from Google documentation.

User Deletion API is used to request the data deletion for a given user. To do so you can use the upsert method specifying one of the identifiers inside id.userId field. Supported user id types are:

  • CLIENT_ID: usable when webPropertyId or propertyId field is set
  • USER_ID: usable when webPropertyId or propertyId field is set
  • APP_INSTANCE_ID: Firebase application instance id – supported when firebaseProjectId orpropertyId& field is set)